Docker registry provisioning
Note. This document describes provisioning procedure. If you want just to update the images, see the updating manual.
To provision a docker registry, you will:
- Prepare the machine
- Install Docker
- Start the registry
- Pull and mirror the images
The following sections describe these steps in details.
Preparing the machine
-
Spawn a VM in VMWare using the CentOS / Ubuntu image as template (the rest of instruction will assume (CentOS 7).
- Choose the machine name
winci-registry
- When asked about which customization to use, select DHCP.
- Choose the machine name
-
Log in using ssh and set the hostname:
Edit the file
/etc/hostname
and type the same name as used in step 1. -
Update the system using
yum upgrade
and reboot. -
Set up static IP:
Log in using ssh and change the IP configuration to manual, by modifying the following file:
/etc/sysconfig/network-scripts/ifcfg-ens192
: Change the line withBOOTPROTO
toBOOTPROTO=static
and add the following lines at the end of that file:
IPADDR=10.84.12.27 NETMASK=255.255.255.0 GATEWAY=10.84.12.254 DNS1=172.21.200.60 DNS2=172.29.131.60 DNS3=8.8.8.8 DOMAIN="contrail.juniper.net englab.juniper.net juniper.net jnpr.net"
This IP is used by the
controller
role in our CI, as adocker_registry
parameter -
Then reboot the machine and log in using the new IP.
Installing Docker
-
Install Docker using package manager
yum install docker systemctl enable docker systemctl start docker
-
Allow the
ci-repo
(from which we will be pulling the images) to use HTTP:-
Add this line to
/etc/docker/daemon.json
(if the file is not there, create it):{ "insecure-registries":["ci-repo.englab.juniper.net:5000"] }{}
-
Restart docker to apply changes
systemctl restart docker
-
Starting the registry
Starting the registry
Start the registry container:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
The container with the registry is set to autostart, so no further configuration is needed.
Pulling and mirroring the images
Refer to the registry update manual to pull and start mirroring the images.
Possible improvements
Perhaps we can also try mirroring base images for speed.